package uk.ac.glasgow.demosocs.users;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import uk.ac.glasgow.demosocs.Election;

public class User implements Serializable {
	private String surname;
	private String forename;
	private String GUID;
	private String password;
	private boolean isManager;
	private Set<Election> nominations;
	
	public User (String surname, String GUID, String forename, String password, boolean isManager){
		this.surname = surname;
		this.forename = forename;
		this.GUID = GUID;
		this.password = password;
		this.isManager = isManager;
		nominations = new HashSet<Election>();
	}
	
	protected boolean authenticate (String password){
		return this.password.equals(password);
	}

	//getters and setters because they make life easier
	
	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getForename() {
		return forename;
	}

	public void setForename(String forename) {
		this.forename = forename;
	}

	public String getGUID() {
		return GUID;
	}
	
	public Set<Election> getNominations(){
		return nominations;
	}

	public void setGUID(String gUID) {
		GUID = gUID;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	public boolean getIsManager() {
		return isManager;
	}
	
	public void addNomination(Election e){
		nominations.add(e);
	}
	
	public void removeNomination(Election e){
		System.out.println("remove!");
		System.out.println(nominations);
		nominations.remove(e);
		System.out.println(nominations);

	}
	
}
